package com.yxd.bdmapdemo;

import android.Manifest;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Toast;

import com.yxd.bdmapdemo.base.BaseNetActivity;
import com.yxd.bdmapdemo.utils.PermissionUtils;

public class SetPermissionActivity extends BaseNetActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_permission);

        findViewById(R.id.tv_camare).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PermissionUtils.checkPer(SetPermissionActivity.this,
                        Manifest.permission.ACCESS_FINE_LOCATION, "请求位置权限",
                        new PermissionUtils.VersionLowMListener() {
                            @Override
                            public void versionLowMAction() {
                                Toast.makeText(SetPermissionActivity.this, "请求位置权限成功", Toast.LENGTH_SHORT).show();
                            }
                        });
            }
        });




    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        PermissionUtils.requestPermissionResult(this, permissions);

    }


}
